<?php
namespace ImiDemo\HttpDemo\MainServer\Model;

use Imi\Model\Model;
use Imi\Model\Annotation\Table;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Relation\AutoSelect;
use Imi\Model\Annotation\Relation\PolymorphicToOne;

/**
 * Avatar
 * @Entity
 * @Table(name="tb_avatar", id={"id"})
 * @property int $id
 * @property int $type
 * @property int $relationId
 * @property string $url
 */
class Avatar extends Model
{
    /**
     * id
     * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true)
     * @var int
     */
    protected $id;

    /**
     * 获取 id
     *
     * @return int
     */ 
    public function getId()
    {
        return $this->id;
    }

    /**
     * 赋值 id
     * @param int $id id
     * @return static
     */ 
    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }

    /**
     * type
     * @Column(name="type", type="tinyint", length=4, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false)
     * @var int
     */
    protected $type;

    /**
     * 获取 type
     *
     * @return int
     */ 
    public function getType()
    {
        return $this->type;
    }

    /**
     * 赋值 type
     * @param int $type type
     * @return static
     */ 
    public function setType($type)
    {
        $this->type = $type;
        return $this;
    }

    /**
     * relation_id
     * @Column(name="relation_id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false)
     * @var int
     */
    protected $relationId;

    /**
     * 获取 relationId
     *
     * @return int
     */ 
    public function getRelationId()
    {
        return $this->relationId;
    }

    /**
     * 赋值 relationId
     * @param int $relationId relation_id
     * @return static
     */ 
    public function setRelationId($relationId)
    {
        $this->relationId = $relationId;
        return $this;
    }

    /**
     * url
     * @Column(name="url", type="varchar", length=255, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false)
     * @var string
     */
    protected $url;

    /**
     * 获取 url
     *
     * @return string
     */ 
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * 赋值 url
     * @param string $url url
     * @return static
     */ 
    public function setUrl($url)
    {
        $this->url = $url;
        return $this;
    }

    /**
     * 对应用户
     * 
     * @PolymorphicToOne(model=ImiDemo\HttpDemo\MainServer\Model\User::class, modelField="id", type="type", typeValue=1, field="relation_id")
     * @AutoSelect(false)
     *
     * @var \ImiDemo\HttpDemo\MainServer\Model\User
     */
    protected $user;

    /**
     * Get 对应用户
     *
     * @return  \ImiDemo\HttpDemo\MainServer\Model\User
     */ 
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Set 对应用户
     *
     * @param  \ImiDemo\HttpDemo\MainServer\Model\User  $user  对应用户
     *
     * @return  self
     */ 
    public function setUser(\ImiDemo\HttpDemo\MainServer\Model\User $user)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * 对应用户
     * 
     * @PolymorphicToOne(model=ImiDemo\HttpDemo\MainServer\Model\Team::class, modelField="id", type="type", typeValue=2, field="relation_id")
     * @AutoSelect(false)
     *
     * @var \ImiDemo\HttpDemo\MainServer\Model\Team
     */
    protected $team;

    /**
     * Get 对应用户
     *
     * @return  \ImiDemo\HttpDemo\MainServer\Model\Team
     */ 
    public function getTeam()
    {
        return $this->team;
    }

    /**
     * Set 对应用户
     *
     * @param  \ImiDemo\HttpDemo\MainServer\Model\Team  $team  对应用户
     *
     * @return  self
     */ 
    public function setTeam(\ImiDemo\HttpDemo\MainServer\Model\Team $team)
    {
        $this->team = $team;

        return $this;
    }

    /**
     * 对应用户
     * 
     * @PolymorphicToOne(model=ImiDemo\HttpDemo\MainServer\Model\User::class, modelField="id", type="type", typeValue=1, field="relation_id")
     * @PolymorphicToOne(model=ImiDemo\HttpDemo\MainServer\Model\Team::class, modelField="id", type="type", typeValue=2, field="relation_id")
     * @AutoSelect(status=false, alwaysShow=false)
     *
     * @var \ImiDemo\HttpDemo\MainServer\Model\User|\ImiDemo\HttpDemo\MainServer\Model\Team
     */
    protected $relationModel;

    /**
     * Get 对应用户
     *
     * @return  \ImiDemo\HttpDemo\MainServer\Model\User|\ImiDemo\HttpDemo\MainServer\Model\Team
     */ 
    public function getRelationModel()
    {
        return $this->relationModel;
    }

    /**
     * Set 对应用户
     *
     * @param  \ImiDemo\HttpDemo\MainServer\Model\User|\ImiDemo\HttpDemo\MainServer\Model\Team  $relationModel  对应用户
     *
     * @return  self
     */ 
    public function setRelationModel($relationModel)
    {
        $this->relationModel = $relationModel;

        return $this;
    }
}